<?php


namespace App\Transformers\User;

use App\Models\UserLoginLog;
use League\Fractal\TransformerAbstract;

class UserLoginLogTransformer extends TransformerAbstract
{
    public function transform(UserLoginLog $userLoginLog)
    {
        return [
            'id' => $userLoginLog->id,
            'user_id'=>$userLoginLog->user_id ?? '',
            'login_ip'=>$userLoginLog->login_ip ?? '',
            'type'=>$userLoginLog->type ?? '',
            'log_type'=>$userLoginLog->typeEnum[$userLoginLog->type] ?? '',
            'equipment_id'=>$userLoginLog->equipment_id ?? '',
            'created_at' => $userLoginLog->created_at ? $userLoginLog->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $userLoginLog->updated_at ? $userLoginLog->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
